import Router from '@/router'

export const getToken = () => {
  return localStorage.getItem('token')
}

const excludes = ['lgName', 'lgPwd']

export const redirectToLogin = (route) => {
  const items = { ...localStorage }
  if (items) {
    for (const key in items) {
      if (excludes.includes(key)) {
        continue
      }
      localStorage.removeItem(key)
    }
  }
  if (route) {
    Router.replace(route)
  } else {
    // Router.replace('/login')
  }
}
